ubg_health_create_icon
Syntax:
ubg_health_create_icon(layer, sprite, x, y, health_min, health_max, columns, padding, event)
Arguments:
Argument Name | Type | Description |
---|---|---|
layer | layer_id | id or name of the layer to create the healthbar on |
sprite | sprite | id of the sprite to use as the health icon |
x | real | x-position to create the healthbar at |
y | real | y-position to create the healthbar at |
health_min | real | minimum value that the health can be |
health_max | real | maximum value that the health can be |
columns | real | number of columns to allow (-1 = unlimited) |
padding | real | padding, in pixels, between each icon |
event | UBG_HEALTH_RENDER_EVENT | enum value from UBG_HEALTH_RENDER_EVENT specifying to render in draw or gui |
Returns: (real)
Description:
This function creates a new healthbar with the visual appearance of individual icons where one icon represents one health unit.
Icons can be limited to the number of columns and they can be animated as well when gaining / losing health. If an animated image is provided the first frame will be the visual when the health unit is full. The last frame will be the visual when the health unit is empty.
An simple example would be something like this:
The available render events are as follows:
- UBG_HEALTH_RENDER_EVENT.draw_normal - Renders in the basic draw event
- UBG_HEALTH_RENDER_EVENT.draw_gui - Renders in the draw gui event
The coordinates you provide this functtion are dependent on which draw event you choose! Using the *draw_normal* mode will render in room coordinates while using *draw_gui* will render in screen coordinates!